#!/bin/bash

echo "start refresh..."
cd /var/hyperledger/orderer/
rm -rf msp/*
rm -rf tls/*

cd /root/
rm -rf orderers
rm -f orderers.tar.gz
rm -f orderers_base64

cp /opt/config/crypto-config/orderers_base64 /root/
base64 -d orderers_base64 > orderers.tar.gz
tar -xzf orderers.tar.gz
cp -r orderers/orderer$3.$1/msp/* /var/hyperledger/orderer/msp/
cp -r orderers/orderer$3.$1/tls/* /var/hyperledger/orderer/tls/
echo "refresh done..."

